
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #box{
            width: 200px;
            height: 200px;
            background: yellow;
            position: absolute;
            left: 0;
            top: 0;
        }
    </style>
</head>
<body>
<div id="box"></div>
</body>
</html>
<script src="js/jquery-1.10.1.js"></script>
<script>
    $(function () {
        $(document).mousemove(function (e) {
            //获取X轴的坐标
            var disX = e.clientX;
            //获取Y轴的坐标
            var disY = e.clientY;
            //将获取到的坐标的值赋给盒子left和top
            $("#box").css({
                left : disX,
                top : disY
            })
        })
    })
</script>